<template>
  <div>
    <!-- 头部标签,专门放导航的 -->
    <div id="head">
      <router-link to="/index?name=张三&age=10" class="nav">首页</router-link>
      <router-link :to="{ path: '/index', query: { num: 11086, shool: '青芒' } }" class="nav">首页</router-link>
      <router-link :to="{ path: '/index', query: obj }" class="nav">首页</router-link>
      <router-link to="/login/张三" class="nav">登录</router-link>
      
      <!-- 必须是组件的名字,不能是路径了 -->
      <router-link :to="{ name:'login', params: { username: '水电费' } }" class="nav">登录</router-link>
      <!-- 无法访问到,路径名不对 <router-link :to="{ path: '/login', params: { username: '水电费' } }" class="nav">登录</router-link> -->
      <!-- <router-link to="/login/张三/110" class="nav">登录</router-link> -->
    </div>
    <router-view></router-view>
  </div>
</template>


<script setup >
// router 路由 url路径 和页面  进行关联起来
// http://192.168.134.3/user    user

import { reactive } from 'vue';

let obj = reactive({
  num: 10010, shool: '北京'
})
</script>

<style scoped>
.nav {
  color: #ccc;
  padding: 10px;
  text-decoration: none;
  transition: all 0.8s;
}

.nav:hover {
  color: aqua;
  border-bottom: 1px solid aqua;
}
</style>